package com.securinets.BD;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class MaBaseOpenHelper extends SQLiteOpenHelper {
	
	 private static final String TABLE_ARTICLES = "table_articles";
	   private static final String COLONNE_ID = "id";
	   private static final String COLONNE_TITRE = "titre";
	   private static final String COLONNE_IMAGE = "image";
	   private static final String COLONNE_DESC = "description";
	   private static final String REQUETE_CREATION_BD = "create table "
	         + TABLE_ARTICLES + " (" + COLONNE_ID
	         + " integer primary key autoincrement, " + COLONNE_TITRE
	         + " text not null, " + COLONNE_IMAGE + " text , " + COLONNE_DESC + " text not null);";

	public MaBaseOpenHelper(Context context, String name,
			CursorFactory factory, int version) {
		super(context, name, factory, version);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		 db.execSQL(REQUETE_CREATION_BD);

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int arg1, int arg2) {
		 db.execSQL("DROP TABLE" + TABLE_ARTICLES + ";");
	      // Création de la nouvelle structure.
	      onCreate(db);

	}

}
